//
//  retweetedView.swift
//  SinaWeiBo
//
//  Created by dengchen on 15/11/17.
//  Copyright © 2015年 name. All rights reserved.
//

import UIKit

class retweetedView: UIView {

    
    var retStatus:statusModel? {
        didSet {
            updateUI()
        }
    }

    
    init() {
        super.init(frame: CGRectZero)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func updateUI() {
    
        retTextView.text = retStatus?.text
        retpictureView.imageURLs = retStatus?.imageURLs
        
    }
    
    private func setupUI() {
        backgroundColor = UIColor(red: 244/255, green: 245/255, blue: 246/255, alpha: 1)
        
        addSubview(retTextView)
        addSubview(retpictureView)
        
        retTextView.snp_makeConstraints { (make) -> Void in
            make.left.top.equalTo(self).offset(CellMargins)
            make.right.equalTo(self).offset(-CellMargins)
        }
        
        retpictureView.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(self).offset(CellMargins)
            make.top.equalTo(retTextView.snp_bottom).offset(CellMargins)
        }
        
        self.snp_makeConstraints { (make) -> Void in
            make.bottom.equalTo(retpictureView).offset(CellMargins)
        }
    }
    
    private let retTextView:UILabel = UILabel(title:nil, Color: UIColor(red: 80/255, green: 80/255, blue: 80/255, alpha: 1), fontSize: 15, textAlignment: .Left)
    
    private let retpictureView:StatusPictureView = StatusPictureView()
}
